home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / clipEditorPanel.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  10.0 KB  |  360 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  August 30, 1999
  22. //
  23. //  Description:
  24. //      This script a panel which has both an outliner and a graph editor
  25. //    within it.
  26. //
  27. //  Input Arguments:
  28. //      None.
  29. //
  30. //  Return Value:
  31. //      None.
  32. //
  33.  
  34. global proc buildClipEditorViewMenu (string $clipEditor, string $parentMenu)
  35. //
  36. //  Procedure Name:
  37. //      buildClipEditorViewMenu
  38. //
  39. //  Description:
  40. //        This creates submenu items for view
  41. //        functionality in the dope sheet.
  42. //
  43. //  Input Arguments:
  44. //      None.
  45. //
  46. //  Return Value:
  47. //      None.
  48. //
  49. {
  50. }
  51.  
  52. global proc buildTraxContextHelpItems(string $nameRoot, string $menuParent)
  53. //
  54. //  Description:
  55. //        Build context sensitive menu items
  56. //        
  57. //  Input Arguments:
  58. //        $nameRoot - name to use as the root of all item names
  59. //        $menuParent - the name of the parent of this menu
  60. //
  61. //  Return Value:
  62. //      None
  63. //
  64. {
  65.     menuItem -label "Help on Trax..."
  66.         -enableCommandRepeat false
  67.         -command "showHelp TraxEditor";
  68. }
  69.  
  70. global proc createClipEditorPanel (string $whichPanel)
  71. //
  72. //  Description:
  73. //        Define the editors that are used in this panel.  No
  74. //        controls (widgets) are created at this point.
  75. //
  76. {
  77.     //  create unique names for editors based on panel name
  78.     //
  79.     string $clipEditor     = ($whichPanel + "ClipEditor");
  80.     string $outlineEditor  = ($whichPanel + "OutlineEditor");
  81.  
  82.     // WARNING: Changes here must also be made in buildNewSceneUI.mel
  83.     //
  84.     characterOutlineEditor -unParent $outlineEditor;
  85.     clipEditor -unParent -characterOutline $outlineEditor $clipEditor;
  86.     
  87.  
  88.     if (`exists clipEditorRegisterActions`) 
  89.         clipEditorRegisterActions $clipEditor;    
  90.  
  91.     //    Add support for the Context Sensitive Help Menu.
  92.     //
  93.     addContextHelpProc $whichPanel "buildTraxContextHelpItems";
  94. }
  95.  
  96. global proc addClipEditorPanel (string $whichPanel)
  97. //
  98. //  Description:
  99. //        Add the panel to a layout.
  100. //        Parent the editors to that layout and create any other
  101. //        controls (widgets) required.
  102. //
  103. {
  104.     string $clipEditor = ($whichPanel + "ClipEditor");
  105.     string $outlineEditor  = ($whichPanel + "OutlineEditor");
  106.     string $outlineEditorForm  = ($whichPanel + "OutlineEditorForm");
  107.  
  108.     formLayout baseForm;
  109.  
  110.     // Make toolbar
  111.     //
  112.     frameLayout 
  113.         -visible true 
  114.         -borderVisible false
  115.         -labelVisible false 
  116.         -collapsable false 
  117.         -collapse true
  118.         -borderStyle "in" 
  119.         toolbarFrame;
  120.     string $toolBarForm = `formLayout -visible true toolbarForm`;
  121.     int $iconsize = 26;
  122.         
  123.     setParent toolbarForm;
  124.  
  125.     iconTextButton
  126.         -i1 "traxCreateClip.xpm" 
  127.         -w $iconsize -h $iconsize
  128.         -annotation "Create Clip"
  129.         createClipButton;
  130.  
  131.     iconTextButton
  132.         -i1 "traxCreateBlend.xpm"
  133.         -w $iconsize -h $iconsize
  134.         -annotation "Create Blend"
  135.         createBlendButton;
  136.  
  137.     separator -horizontal false -style single ctbSeparator1;
  138.  
  139.     iconTextButton
  140.         -i1 "hsVisorOpen.xpm"
  141.         -w $iconsize -h $iconsize
  142.         -annotation "Visor"
  143.         openVisorButton;
  144.  
  145.     separator -horizontal false -style single ctbSeparator2;
  146.  
  147.     iconTextButton
  148.         -i1 "traxFrameAll.xpm"
  149.         -w $iconsize -h $iconsize
  150.         -annotation "Frame All"
  151.         frameAllButton;
  152.  
  153.     iconTextButton
  154.         -i1 "traxFrameRange.xpm"
  155.         -w $iconsize -h $iconsize
  156.         -annotation "Frame Timeline Range"
  157.         frameRangeButton;
  158.  
  159.     separator -horizontal false -style single ctbSeparator3;
  160.  
  161.     iconTextButton
  162.         -i1 "traxGraphAnimCurves.xpm"
  163.         -w $iconsize -h $iconsize
  164.         -annotation "Graph Anim Curves"
  165.         graphAnimCurvesButton;
  166.  
  167. /*
  168.     iconTextButton
  169.         -i1 "traxGraphWeightCurves.xpm"
  170.         -w $iconsize -h $iconsize
  171.         -annotation "Graph Weight Curves"
  172.         graphWeightCurvesButton;
  173. */
  174.  
  175.  
  176.     formLayout -edit
  177.         -attachForm    createClipButton        "left"         0
  178.         -attachForm    createClipButton        "top"         0
  179.         -attachForm       createClipButton        "bottom"     0
  180.  
  181.         -attachControl createBlendButton    "left"         0 createClipButton
  182.  
  183.         -attachControl ctbSeparator1        "left"         0 createBlendButton
  184.         -attachForm    ctbSeparator1        "top"          1 
  185.         -attachForm       ctbSeparator1        "bottom"    1 
  186.  
  187.         -attachControl openVisorButton        "left"         0 ctbSeparator1
  188.  
  189.         -attachControl ctbSeparator2        "left"         0 openVisorButton
  190.         -attachForm    ctbSeparator2        "top"          1 
  191.         -attachForm       ctbSeparator2        "bottom"    1 
  192.  
  193.         -attachControl frameAllButton        "left"         0 ctbSeparator2
  194.         -attachControl frameRangeButton        "left"         0 frameAllButton
  195.  
  196.         -attachControl ctbSeparator3        "left"         0 frameRangeButton
  197.         -attachForm    ctbSeparator3        "top"          1 
  198.         -attachForm       ctbSeparator3        "bottom"    1 
  199.  
  200.         -attachControl graphAnimCurvesButton "left"         0 ctbSeparator3
  201. /*        -attachControl graphWeightCurvesButton "left"         0 graphAnimCurvesButton */
  202.  
  203.         toolbarForm;
  204.  
  205.     setParent baseForm;
  206.     
  207.     // Define container widget to hold the clip editor and outline.
  208.     $containerWidget = `rowLayout -numberOfColumns 2
  209.             -adjustableColumn 2 -columnWidth 1 200
  210.             -rowAttach 1 "both" 0 -columnAttach 1 "both" 0
  211.             -rowAttach 2 "both" 0 -columnAttach 2 "both" 0`;
  212.     
  213.     // Create a form to hold the outline and its resize buttons.
  214.     formLayout -parent $containerWidget $outlineEditorForm;
  215.     characterOutlineEditor -edit -parent $outlineEditorForm $outlineEditor;
  216.     
  217.     // Put the clip editor into the container.
  218.     clipEditor -edit -parent $containerWidget $clipEditor;
  219.     
  220.     // Add two resize buttons to the outline form to control the size of
  221.     // the form which holds the outline and the clis editor.
  222.     button -l "<<" -parent $outlineEditorForm
  223.         -h 15 -rs false
  224.         -ann "Decrease outline size"
  225.         -command ( "setCharacterOutlineSize smaller " + $containerWidget )
  226.         characterOutlineSmallerButton;
  227.     button -l ">>" -parent $outlineEditorForm
  228.         -h 15 -rs false
  229.         -ann "Increase outliner size"
  230.         -command ( "setCharacterOutlineSize bigger " + $containerWidget )
  231.         characterOutlineBiggerButton;
  232.     
  233.     // Layout the outline form.
  234.     formLayout -e
  235.         -af characterOutlineSmallerButton left 0
  236.         -ap characterOutlineSmallerButton right 0 50
  237.         -af characterOutlineSmallerButton bottom 0
  238.         -an characterOutlineSmallerButton top 
  239.  
  240.         -ap characterOutlineBiggerButton left 0 50
  241.         -af characterOutlineBiggerButton right 0
  242.         -af characterOutlineBiggerButton bottom 0
  243.         -an characterOutlineBiggerButton top 
  244.  
  245.         -af $outlineEditor left 0
  246.         -af $outlineEditor right 0
  247.         -af $outlineEditor top 0
  248.         -ac $outlineEditor bottom 0 characterOutlineSmallerButton
  249.         $outlineEditorForm;
  250.  
  251.     // Ensure that the outline layout is the correct size,
  252.     // based on the optionVar characterOutlineEditorWidth.
  253.     global int $gCharacterOutlineEditorWidth;
  254.     if( !`optionVar -exists characterOutlineEditorWidth` ) {
  255.         optionVar -iv characterOutlineEditorWidth 200;
  256.     } 
  257.     $gCharacterOutlineEditorWidth = `optionVar -q characterOutlineEditorWidth`;
  258.     rowLayout -e -columnWidth 1 $gCharacterOutlineEditorWidth $containerWidget;
  259.  
  260.     // attach the the container widget to the edges of the base form
  261.     // and the bottom of the toolbar
  262.     //
  263.     formLayout -edit
  264.         -attachForm toolbarFrame top 0
  265.         -attachForm toolbarFrame left 0
  266.         -attachForm toolbarFrame right 0
  267.         -attachForm $containerWidget left 0
  268.         -attachForm $containerWidget right 0
  269.         -attachForm $containerWidget bottom 0
  270.         -attachControl $containerWidget top 0 toolbarFrame
  271.         baseForm;
  272.  
  273.     setParent `scriptedPanel -query -control $whichPanel`;
  274.  
  275.     setParent -top;
  276. }
  277.  
  278. global proc setCharacterOutlineSize (string $size, string $rowLayout)
  279. //
  280. //
  281. {
  282.     global int $gCharacterOutlineEditorWidth;
  283.  
  284.     if( $size == "bigger" ) {
  285.         if( $gCharacterOutlineEditorWidth <= 300 ) {
  286.             $gCharacterOutlineEditorWidth = $gCharacterOutlineEditorWidth + 20;
  287.         }
  288.     } else {
  289.         if( $gCharacterOutlineEditorWidth >= 200 ) {
  290.             $gCharacterOutlineEditorWidth = $gCharacterOutlineEditorWidth - 20;
  291.         }
  292.     }
  293.  
  294.     rowLayout -e -columnWidth 1 $gCharacterOutlineEditorWidth $rowLayout;
  295.     optionVar -iv characterOutlineEditorWidth $gCharacterOutlineEditorWidth;
  296. }
  297.  
  298. global proc removeClipEditorPanel (string $whichPanel)
  299. //
  300. //  Description:
  301. //        Remove the panel from a layout.
  302. //        Delete controls.
  303. //
  304. {
  305.     string $clipEditor = ($whichPanel + "ClipEditor");
  306.  
  307.     if (`clipEditor -exists $clipEditor`) {
  308.         clipEditor -edit -unParent $clipEditor;
  309.     }
  310. }
  311.  
  312. global proc deleteClipEditorPanel (string $whichPanel)
  313. //
  314. //  Description:
  315. //        This proc will delete the contents of the panel, but not
  316. //        the panel itself.
  317. //
  318. //  Note:
  319. //        We only need to delete editors here.  Other UI will be taken care of
  320. //        by the remove proc.
  321. //
  322. {
  323.     string $clipEditor = ($whichPanel + "ClipEditor");
  324.  
  325.     if (`clipEditor -exists $clipEditor`) {
  326.         deleteUI -editor $clipEditor;
  327.     }
  328. }
  329.  
  330. global proc string saveStateClipEditorPanel (string $whichPanel)
  331. //
  332. //  Description:
  333. //        This proc returns a string that when executed will restore the
  334. //        current state of the panel elements.
  335. //
  336. {
  337.     string $indent = "\n\t\t\t";
  338.     string $clipEditor = ($whichPanel + "ClipEditor");
  339.  
  340.     return (
  341.             $indent + "$editorName = ($panelName+\"ClipEditor\");\n" +
  342.             `clipEditor -query -stateString $clipEditor`
  343.     );
  344. }
  345.  
  346. global proc clipEditorPanel (string $panelName)
  347. {
  348. }
  349.  
  350. global proc string [] clipEditorFilterCategories()
  351. //
  352. //    Description:
  353. //        Return the types of filters that the Clip Editor will display
  354. //        in its "Show->Objects" filter menu.
  355. //
  356. {
  357.     string $result[] = { "Modeling", "Camera", "Animating" };
  358.     return $result;
  359. }
  360.